package priv.wjh.study.easyexcel.image;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;

import java.util.ArrayList;
import java.util.List;
public class ImageExport {
    public static void main(String[] args) {
        // 准备数据
        List<ImagePo> images = new ArrayList<>();
        images.add(new ImagePo(1, "https://money.gucheng.com/UploadFiles_6503/201901/2019012516201400.jpg",
                               "https://money.gucheng.com/UploadFiles_6503/201901/2019012516201400.jpg,https://money.gucheng.com/UploadFiles_6503/201901/2019012516201400.jpg"));
        images.add(new ImagePo(2,"https://img1.cache.netease.com/ent/2016/8/23/20160823221523324f5.jpg", "https://money.gucheng.com/UploadFiles_6503/201901/2019012516201400.jpg,https://money.gucheng.com/UploadFiles_6503/201901/2019012516201400.jpg"));

//        EasyExcel.write("./test.xlsx")
//                .sheet("excel")
//                .doWrite(images);


        EasyExcel.write("./test.xlsx")
                .autoCloseStream(true)
                .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                .registerWriteHandler(new CustomImageModifyHandler())
                .sheet("临库盘点导出")
                .doWrite(images);

    }
}


